package com.xinghuo.learning;

import com.xinghuo.learning.netty.NettyServer;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.*;

public class A implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        Thread.sleep(1000 * 5);
        return 1;
    }

    public static void main(String[] args) throws InterruptedException, IllegalAccessException, InstantiationException {
        Class cla = NettyServer.class;
        NettyServer nettyServer = (NettyServer) cla.newInstance();

        Method[] methods = cla.getDeclaredMethods();
        cla.getFields();
        cla.getConstructors();
        for (Method method : methods) {
//            System.out.println(method.getName());
        }
        try {
            Class clasObj = Class.forName("com.xinghuo.learning.netty.NettyClient");
            Object object = clasObj.newInstance();
            Method[] methodss = clasObj.getDeclaredMethods();
            for (Method method : methodss) {
                if (!method.isDefault()) {
                    System.out.println(method.getName());
                    method.invoke(object, null);
                }
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
}
